package com.lixixi.tingshu.album.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.lixixi.tingshu.album.mapper.BaseAttributeMapper;
import com.lixixi.tingshu.album.service.BaseCategory1Service;
import com.lixixi.tingshu.album.service.BaseCategory2Service;
import com.lixixi.tingshu.album.service.BaseCategory3Service;
import com.lixixi.tingshu.album.service.BaseCategoryService;
import com.lixixi.tingshu.model.album.BaseAttribute;
import com.lixixi.tingshu.model.album.BaseCategory1;
import com.lixixi.tingshu.model.album.BaseCategory3;
import com.lixixi.tingshu.model.album.BaseCategoryView;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BaseCategoryServiceImpl implements BaseCategoryService {
	//一级分类
	@Resource
	BaseCategory1Service baseCategory1Service;

	//二级分类
	@Resource
	BaseCategory2Service baseCategory2Service;

	//三级分类
	@Resource
	BaseCategory3Service baseCategory3Service;

	@Resource
	BaseAttributeMapper baseAttributeMapper;


	@Override
	public List<BaseAttribute> findBaseCategory1Attribute(Long baseCategory1Id) {
		return baseAttributeMapper.selectBaseCategory1Atrribute(baseCategory1Id);
	}

	@Override
	public List<BaseCategory3> findTopBaseCategory3(Long categoryId1) {
		return baseCategory3Service.findTopBaseCategory3(categoryId1);
	}

	@Override
	public List<BaseCategory3> findBaseCategory3(Long categoryId1) {
		return baseCategory3Service.findBaseCategory3(categoryId1);
	}

	@Override
	public List<Long> getCategory1IdAll() {
		return baseCategory1Service.list()
				.stream()
				.map(baseCategory1 -> baseCategory1.getId())
				.toList();
	}
}
